# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python-pymisp
_pkgname=pymisp
pkgver=2.5.12
_pyver=3.13
pkgrel=1
pkgdesc='Python API for MISP.'
arch=('any')
url='https://pypi.org/project/pymisp/#files'
license=('BSD')
depends=('python' 'python-six' 'python-dateutil' 'python-jsonschema'
         'python-requests' 'python-deprecated')
makedepends=('python-pip' 'python-build' 'python-wheel')
optdepends=('python-virustotal-api: VirusTotal support')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('fd41c8bb4ac90356c4a5525c6e0d6082ae82a1f935b0b1db8d4ba3f0ee658aef6fc21615e0279e67084376bac00fc21346416595183da973ee0f33d9aa4f27f4')

build() {
  cd "$_pkgname-$pkgver"

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd "$_pkgname-$pkgver"

  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --ignore-installed \
    --no-compile \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    $_pkgname

  rm -rf "$pkgdir/usr/lib/python$_pyver/site-packages/"{README.md,CHANGELOG.txt}
}

